<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>

<s:useActionBean beanclass="cz.muni.fi.pa165.web.SecurityActionBean" var="securityBean"/>
<f:message key="title.mushroomlist" var="headline" />
<s:layout-render name="/layout.jsp" headline="${headline}">
	<s:layout-component name="content">
		<s:useActionBean beanclass="cz.muni.fi.pa165.web.MushroomsActionBean" var="actionBean"/>

		<table class="listtable">
			<tr>
				<th width="50%"><f:message key="mushroom.name"/></th>
				<th width="12%"><f:message key="mushroom.edibility"/></th>
				<th width="12%"><f:message key="mushroom.growFrom"/></th>
				<th width="12%"><f:message key="mushroom.growTo"/></th>
				<th width="5%"></th>
				<th width="5%"></th>
			</tr>
			<c:forEach items="${actionBean.mushrooms}" var="mushroom" varStatus="status">
				<tr class="${(status.count % 2 == 0 ) ? "even" : "odd"}">
					<td><c:out value="${mushroom.name}"/></td>
					<td><f:message key="Edibility.${mushroom.edibility}"/></td>
					<td><f:message key="Month.${mushroom.growFrom}"/></td>
					<td><f:message key="Month.${mushroom.growTo}"/></td>
					<td><s:link beanclass="cz.muni.fi.pa165.web.MushroomsActionBean" event="edit"><s:param name="mushroom.id" value="${mushroom.id}"/><f:message key="edit"/></s:link> </td>
					<td><s:link addSourcePage="true" beanclass="cz.muni.fi.pa165.web.MushroomsActionBean" event="delete" class="deleteentity" title="${mushroom.name}"><s:param name="mushroom.id" value="${mushroom.id}"/><f:message key="delete"/></s:link> </td>
					</tr>
			</c:forEach>
		</table>
                                
                <s:form beanclass="cz.muni.fi.pa165.web.MushroomsActionBean">
                    <f:message key="mushroom.show"/>
                    <s:submit name="showAll"><f:message key="mushroom.showAll"/></s:submit>
                    <s:submit name="showEdible"><f:message key="mushroom.showEdible"/></s:submit>
                    <s:submit name="showNotEdible"><f:message key="mushroom.showNotEdible"/></s:submit>
                    <s:submit name="showPoisonous"><f:message key="mushroom.showPoisonous"/></s:submit>
                    
                                       
                </s:form>
                           

		<s:form beanclass="cz.muni.fi.pa165.web.MushroomsActionBean">
			<fieldset><legend><f:message key="mushroom.new"/></legend>
				<%@include file="mushroomform.jsp"%>
				<s:submit name="add"><f:message key="create"/></s:submit>
				</fieldset>
		</s:form>
				
	</s:layout-component>
</s:layout-render>
